//
//  BaseModel.m
//  KuaiXiuQiang
//
//  Created by 刘佳慧 on 16/4/28.
//  Copyright © 2016年 刘佳慧. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel

+ (NSMutableArray *)baseModelByArr:(NSArray *)arr{
    
    NSMutableArray *array = [NSMutableArray array];
    for (NSDictionary *dic in arr) {
        id model = [[self class] baseModelWith:dic];
        [array addObject:model];
    }
    return array;
    
}

+ (instancetype)baseModelWith:(NSDictionary *)dic{
    
    id model = [[[self class] alloc]initWithDic:dic];;
    return model;
    
}

- (instancetype)initWithDic:(NSDictionary *)dic{
    
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
    
}

@end
